#include <stdio.h>
#include <string.h>

//计算阶乘
int j(int n)
{
    int sum = 1;
    for (int i = 1; i <= n; i++)
        sum *= i;
    return sum;
}

int main()
{
    int n, b[27] = {0};
    char a[21];
    scanf("%d%s", &n, a);
    int sum = j(n);
    int len = strlen(a);
    //利用下标统计各个字母出现次数
    for (int i = 0; i < len; i++)
        b[a[i] % 97]++;
    //当该下标所代表的字母不为0时，让sum / 该字母出现次数的阶乘
    for (int i = 0; i < 26; i++)
        if (b[i] > 0)
            sum /= j(b[i]);

    printf("%d\n", sum);
    return 0;
}
